﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler
{
    public class MenuUpdateCommandHandler : IRequestHandler<MenuUpdateCommand, int>
    {
        protected readonly IMenuSerivice serivice;

        public MenuUpdateCommandHandler(IMenuSerivice serivice)
        {
            this.serivice = serivice;
        }

        public async Task<int> Handle(MenuUpdateCommand request, CancellationToken cancellationToken)
        {
            return await serivice.MenuDelete(new MenuInfo()
            {
                MenuInfoid = request.MenuInfoid,
                MenuInfoName = request.MenuInfoName,
                CreateBy = request.CreateBy,
                CreateDate = request.CreateDate,
                Pid = request.Pid,
                Url = request.Url
            });
        }
    }
}
